package com.kaifamiao.demo.d0815;

public class FeiBo {

    public static void main(String[] args) {
        FeiBo feiBo = new FeiBo();

        for (int i = 1; i < 20; i++) {
            System.out.print(feiBo.fibo(i) + "\t");
        }
        System.out.println(feiBo.fibo(10));
    }


    public long fibo( long n ){
        if (n < 0){
            throw new IllegalArgumentException("参数异常: " + n);
        }
        if (n == 0){
            return 0;
        }
        // 递归结束条件
        if (n == 1){
            return 1;
        }
        return fibo(n - 1) + fibo(n - 2);
    }
}
